package com.jiaxz.config;

import feign.Feign;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import feign.Contract;
import feign.Logger;
import feign.auth.BasicAuthRequestInterceptor;
import org.springframework.context.annotation.Scope;

@Configuration
public class UserFeignConfiguration {
	/**
	 * 设置使用自定义feign配置
	 * 
	 * @return
	 */
	@Bean
	public Contract feignContractg() {
		return new feign.Contract.Default();
	}

	/**
	 * 设置访问euraka 信息用户名密码
	 * 
	 * @return
	 */
	@Bean
	public BasicAuthRequestInterceptor basicAuthRequestInterceptor() {
		return new BasicAuthRequestInterceptor("user", "password123");
	}

	/**
	 * 设置打印feign的日志
	 * 
	 * @return
	 */
	@Bean
	Logger.Level feignLoggerLevel() {
		return Logger.Level.FULL;
	}
	@Bean
	@Scope("prototype")
	public Feign.Builder builder(){
		return new Feign.Builder();
	}
}
